package com.meichis.yndms.model;

import java.io.Serializable;
import java.util.Map;

/**
 * Created by pei on 2016/8/24.
 */
public class InspectTemplate_Item implements Serializable{

    private int ID;
    //巡查项目
    private InspectItem Item = new InspectItem();
    //排序
    private int SortID;
    //是否必填 1必填，2选填
    private int IsMustFill;
    //检查结果(代码)
    private String FillValue = "";
    //检查结果(名称)
    private String FillName = "";
    //备注
    private String Remark = "";

    private String ItemGroup = "";

    //活动打分环节用的标识
    private String processCode = "";

    private int DefaultNextItem;

    private Map<String, Integer> ItemRoutes;

    public InspectItem getItem() {
        return Item;
    }

    public void setItem(InspectItem item) {
        Item = item;
    }

    public int getSortID() {
        return SortID;
    }

    public void setSortID(int sortID) {
        SortID = sortID;
    }

    public int getIsMustFill() {
        return IsMustFill;
    }

    public void setIsMustFill(int isMustFill) {
        IsMustFill = isMustFill;
    }

    public String getFillValue() {
        if (FillName == null) {
            setDefaultValue();
        }
        return FillValue;
    }

    public void setFillValue(String fillValue) {
        FillValue = fillValue;
    }

    public String getFillName() {
        if (FillValue == null) {
            setDefaultValue();
        }
        return FillName;
    }

    public void setFillName(String fillName) {
        FillName = fillName;
    }

    public String getRemark() {
        return Remark;
    }

    public void setRemark(String remark) {
        Remark = remark;
    }

    public String getItemGroup() {
        return ItemGroup;
    }

    public void setItemGroup(String itemGroup) {
        ItemGroup = itemGroup;
    }

    public String getProcessCode() {
        return processCode;
    }

    public void setProcessCode(String processCode) {
        this.processCode = processCode;
    }

    private void setDefaultValue() {
        FillValue = Item.getDefaultValue();
        FillName = FillValue;
        if (Item.getFillMode() == 5 && !Item.getDefaultValue().equals("")) {
            FillValue = "Y".equals(FillValue) ? "Y" : "N";
            FillName = "Y".equals(FillValue) ? "是" : "否";
        } else {
            for (InspectItemOption option : Item.getOptions()) {
                if (FillValue.equals(option.getCode())) {
                    FillName = option.getName();
                    return;
                }
            }
        }
    }

    public Map<String, Integer> getItemRoutes() {
        return ItemRoutes;
    }

    public void setItemRoutes(Map<String, Integer> itemRoutes) {
        ItemRoutes = itemRoutes;
    }

    public int getDefaultNextItem() {
        return DefaultNextItem;
    }

    public void setDefaultNextItem(int defaultNextItem) {
        DefaultNextItem = defaultNextItem;
    }

    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }
}
